package edu.gznu.ics.fast.pulsar.service.prestoacc.picService.impl;

import edu.gznu.ics.fast.pulsar.dao.prestoacc.pic.PicQueryViewMapper;

import edu.gznu.ics.fast.pulsar.model.vo.web.PicQueryResultVO;
import edu.gznu.ics.fast.pulsar.model.vo.web.QueryCommandVO;
import edu.gznu.ics.fast.pulsar.service.prestoacc.picService.PicInfoQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.LinkedList;

/**
 * Created by fei-zyx on 2016/10/19.
 */
@Service("picInfoQueryService")

//@Cacheable
public class PicInfoQueryServiceImply implements PicInfoQueryService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private PicQueryViewMapper picQueryViewMapper;

    @Override
    //@Cacheable(value = "picQueryCache", key="#p0.sql+#p1")
    public java.util.List<PicQueryResultVO> findPicInfoBySql(QueryCommandVO queryCommandVO, String user) {

        java.util.List<PicQueryResultVO> queryResultVOList = new LinkedList<PicQueryResultVO>();
        queryResultVOList = picQueryViewMapper.queryPicInfoBySqlCommand(queryCommandVO.getSql());
/*

      java.util.List<TaskMonitorDetailItemVO> itemList = new LinkedList<TaskMonitorDetailItemVO>();
        java.util.List<Map<String, Object>> results = jdbcTemplate.queryForList(queryCommandVO.getSql());
*/

        return queryResultVOList;
    }
}
